package com.mavenq.fly.business.vo;

import com.mavenq.fly.business.entity.Family;
import com.mavenq.fly.business.entity.OperationLog;
import com.mavenq.fly.business.service.LogService;
import com.mavenq.fly.utils.SpringContextUtils;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;

@Data
public class Person {
    private Long id;
    @NotNull(message = "姓名不能为空")
    private String name;
    @Max(value = 100, message = "姓名最大值是100")
    private Integer age;
    private Date birthday;
    private List<String> hobbies;
    private Family family;

    public OperationLog exec() throws InterruptedException {
        LogService logService = SpringContextUtils.getBean(LogService.class);
        System.out.println("logService对象hashCode：" + logService.hashCode());
        OperationLog operationLog = new OperationLog();
        operationLog.setTitle("测试下" + id);
        OperationLog operationLog1 = logService.saveLog(operationLog);
        System.out.println("测试结束" + id);
        return operationLog1;
    }
}
